# -*- coding: utf-8 -*-
Shoes.app do
  figures = ["７", "★", "♪", "◆", "●"]
  no1_figures = figures.sort_by { rand }
  no2_figures = figures.sort_by { rand }
  no3_figures = figures.sort_by { rand }

  index = 1
  no1 = banner(no1_figures[index], :font => "MS Gothic")
  no1.move(20, 10)
  no2 = banner(no2_figures[index], :font => "MS Gothic")
  no2.move(120, 10)
  no3 = banner(no3_figures[index], :font => "MS Gothic")
  no3.move(220, 10)

  no1_stopped = false
  no2_stopped = false
  no3_stopped = false
  
  animate(10) do
    index += 1
    if index >= figures.length
      index = 0
    end
    if !no1_stopped
      no1.replace(no1_figures[index])
    end
    if !no2_stopped
      no2.replace(no2_figures[index])
    end
    if no3_stopped
      if no1.text == no2.text && no1.text == no3.text
        good = banner("Good!!")
        good.move(120, 100)
      else
        bad = banner("Bad.")
        bad.move(120, 100)
      end
    else
      no3.replace(no3_figures[index])
    end
  end

  click do
    if !no1_stopped
      no1_stopped = true
    elsif !no2_stopped
      no2_stopped = true
    elsif !no3_stopped
      no3_stopped = true
    end
  end
end
